import { request } from '../request';

/** 声音 列表 */
export function fetchVoiceList() {
  return request<any>({
    url: '/timbre/list',
    method: 'get'
  });
}
/** 声音 试听 */
export function fetchListenVoice(data: any) {
  return request<any>({
    url: '/voice/getTextToVoice',
    method: 'post',
    data
  });
}

/** 预览请求 */
export function fetchPreview(data: any) {
  return request<any>({
    url: '/creation/preview',
    method: 'post',
    data
  });
}

/** 数字人 列表 */
export function fetchDigitalList() {
  return request<any>({
    url: '/personInfo/list',
    method: 'get'
  });
}

/** 背景图 列表 */
export function fetchBgList() {
  return request<any>({
    url: '/background/list',
    method: 'get'
  });
}

/** 背景图 删除 */
export function deleteCustomBackgroundApi(id: string) {
  return request<any>({
    url: `/background/${id}`,
    method: 'delete'
  });
}

/** 背景图 上传 */
export function createCustomBackgroundApi(data: any) {
  return request<any>({
    url: `/background`,
    method: 'post',
    data
  });
}

/** 道具 列表 */
export function fetchMaterialList() {
  return request<any>({
    url: '/property/list',
    method: 'get'
  });
}

/** 创作任务 = 添加任务 x */
export function createTaskApi(data: any) {
  return request<any>({
    url: '/creation/add',
    method: 'post',
    data
  });
}

/** 创作任务 = 更新任务 */
export function updateTaskApi(data: any) {
  return request<any>({
    url: '/creation',
    method: 'put',
    data
  });
}

/** 创作任务 = 更新任务信息 */
export function updateTaskInfoApi(data: any) {
  return request<any>({
    url: '/creation/update',
    method: 'post',
    data
  });
}
/** 创作任务 = 分页列表 */
export function fetchTaskListApi(params: any) {
  return request<any>({
    url: '/creation/page',
    method: 'post',
    params
  });
}

/** 创作任务 = 轮询列表 */
export function fetchTaskIdsListApi(params: any) {
  return request<any>({
    url: '/creation/queryByIds',
    method: 'get',
    params: {
      ids: params.join(',')
    }
  });
}

/** 创作任务 = 查询详情 */
export function fetchTaskApi(id: any) {
  return request<any>({
    url: `/creation/${id}`,
    method: 'get'
  });
}

/** 创作任务详情 = 添加任务 */
export function createTaskDetailApi(data: any) {
  return request<any>({
    url: '/creationDetail',
    method: 'post',
    data
  });
}

/** 创作任务详情 = 更新任务 */
export function updateTaskDetailApi(data: any) {
  return request<any>({
    url: '/creationDetail',
    method: 'put',
    data
  });
}

/** 创作任务 = 查询详情 */
export function fetchTaskDetailApi(id: any) {
  return request<any>({
    url: `/creationDetail/${id}`,
    method: 'get'
  });
}

/** 创作任务详情 = 删除任务 */
export function deleteTaskDetailApi(id: any) {
  return request<any>({
    url: `/creation/${id}`,
    method: 'delete'
  });
}
